package simtools.xml.test;

import java.io.*;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;

/**
 * Basic JDOM Example
 * Outputs any local XML file specified on the command line
 * Example usage:
 * java jdom1 document.xml
 */

public class Jdom1 {
	//Download and Output XML File
	public void process(String fileName) {
		try {
			//  Use SAXBuilder
			SAXBuilder builder = new SAXBuilder();
			Document doc = builder.build(new File(fileName));

			//  Use XMLOutputter
			XMLOutputter out = new XMLOutputter();
			out.output(doc, System.out);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		String file = "C:/Kalil/workspace/TxtToXml/src/Routers.xml";
		System.out.println("JDOM1 Example");
		System.out.println("Downloading file:  " + file);
		Jdom1 app = new Jdom1();
		app.process(file);
	}

}
